package org.yray.thead;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

public class ThreadCreate {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer>  futureTask= new FutureTask<>(()->{
            Thread.sleep(5000);
            return 1;
        });
        Thread t=new Thread(futureTask);
        t.start();

        futureTask.get();

    }
}
